<?php
namespace app\api\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class User extends Validate
{
    //定义验证规则
    protected $rule = [
        'phone|手机号'  => 'require|mobile',
        'work_number|工号'  => 'require',
        'real_name|姓名'  => 'require',
        'sex|性别'  => 'require',
        'age|年龄'  => 'require',
        'type_id|工种'  => 'require',
        'work_time|入职时间'  => 'require',
        'overtime|超时时间'  => 'require',
        'is_open|下单'  => 'require',
        'is_recharge|充值'  => 'require',
        'is_pay|支付'  => 'require',
        'is_retreat|退钟'  => 'require',
        'is_room|房间'  => 'require',
        'is_hand_card|手牌'  => 'require',
        'is_room_content|备注'  => 'require',
        'top_type_id|工种分类'  => 'require',
    ];
    //定义验证提示
    protected $message = [
        'phone.require' => '请填写手机号',
        'phone.mobile' => '请填写正确的手机号',
        'card.number' => '身份证号',
        'work_number.require' => '请填写工号',
        'real_name.require' => '请填写姓名',
        'sex.require' => '请选择性别',
        'age.require' => '请填写年龄',
        'type_id.require' => '请选择工种',
        'work_time.require' => '请填写入职时间',
        'overtime.require' => '请填写超时时间',
        'is_open.require' => '请填写下单权限',
        'is_recharge.require' => '请填写充值权限',
        'is_pay.require' => '请填写支付权限',
        'is_retreat.require' => '请填写退钟权限',
        'is_room.require' => '请填写房间状态权限',
        'is_hand_card.require' => '请填写手牌结账权限',
        'is_room_content.require' => '请填写显示房间备注权限',
        'top_type_id.require' => '请选择工种分类',
    ];
    //定义验证场景
    protected $scene = [
        'add'   =>  ['phone'],
        'add_engineer'   =>  ['phone','work_number','real_name','sex','age','type_id','work_time','overtime','is_open','is_recharge','is_pay','is_retreat','is_room','is_hand_card','is_room_content','project_ids','top_type_id'],
        'add_floor'      =>  ['work_number','card','phone','real_name','sex','work_time','post_id','sex','select_report_time','select_list_time','hand_code','operation'],
        'add_save'   =>  ['phone','real_name','sex','type_id','work_time',],
        'edit_engineer'   =>  ['phone','real_name','sex','type_id','work_time',],

    ];
}
